package com.shf.threads;

public class ThreadSafeTest implements Runnable {
	int num = 10 ;
	@Override
	public void run() {
		while (num>0) {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println("tickets"+num--);
		}
	}

	public static void main(String[] args) {
		ThreadSafeTest safeTest = new ThreadSafeTest();
		Thread thread = new Thread(safeTest);
		Thread thread2 = new Thread(safeTest);
		Thread thread3 = new Thread(safeTest);
		Thread thread4 = new Thread(safeTest);
		
		thread.start();
		thread2.start();
		thread3.start();
		thread4.start();
		
	}
	
}
